@extends('layout.wechat_frame')

@section('main')

    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title">已报价标书</h1>
    </header>
    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed">

            @if (count($bids) > 0)
                @foreach ($bids as $k => $bid)

                    <li class="mui-table-view-cell">
                        <div class="mui-table">
                            <div class="mui-table-cell mui-col-xs-10">
                                <h5 class="mui-ellipsis">编号：{{ $bid->code }}</h5>
                                <?php
                                $goods = json_decode($bid->goods_static);

                                // 因为经过需求汇总，所以采购数量为各需求的和
                                $quantity = 0;
                                foreach ($bid->demands as $value) {
                                    $quantity = $quantity + $value->quantity;
                                }
                                ?>
                                <h5><span class="ips-span-first">{{ $goods->name }}</span>&nbsp;&nbsp;<span>采购数量：{{ strval((float)$quantity) }} {{ $goods->unit }}</span></h5>
                                <p class="mui-h6 mui-ellipsis">报价期间：{{ $bid->offer_start }} 至 {{ $bid->offer_stop }}</p>
                            </div>
                        </div>
                        <div>

                            <!--<button type="button" class="ips-row-btn mui-btn-red" >查看</button>-->
                            {!! \App\Services\IPSWechatHelper::showButton(['type'=>'link', 'title'=>'查看标书', 'href'=>route('bidQuote.bqListDetail', ['bid' => $bid->id]), 'css'=>'ips-row-btn mui-btn-red', 'text'=>'查看']) !!}

                        </div>
                    </li>

                @endforeach
            @else
                <li class="mui-table-view-cell">
                    <div class="mui-table">
                        <div class="mui-table-cell mui-col-xs-10">
                            <h5 >没有找到记录</h5>
                        </div>
                    </div>
                </li>
            @endif
        </ul>
    </div>
@stop

@section('page')
    {!! $pages !!}
@endsection

@section('js')
@stop